package cn.qyd.javamap;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * @author 邱运铎
 * @date 2024-03-16 17:28
 */
public class PriorityQueueDemo {
    public static void main(String[] args) {
//        PriorityQueue<String> priorityQueue = new PriorityQueue<>();
        PriorityQueue<String> priorityQueue = new PriorityQueue<>(Comparator.reverseOrder());
        priorityQueue.offer("qiuyunduo");
        priorityQueue.offer("qyd");
        priorityQueue.offer("Java");
        priorityQueue.offer("Python");

        System.out.println(priorityQueue);
        System.out.println(priorityQueue.peek());
        System.out.println(priorityQueue);
        priorityQueue.poll();
        System.out.println(priorityQueue);
    }
}
